﻿using LitJson;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Toolkit
{
    public class Config
    {
        #region 公共变量.
        //BPM服务器地址.
        public static string BPMHost = "http://vue3.ccflow.org/WF/API";
        public static string Domain = ""; //项目编号

        //拼接访问地址
        static string webPath = "";
        /// <summary>
        /// 默认登录部门
        /// </summary>
        public static string DeptDefaultNo = "0";
        #endregion 公共变量.

        public static string GenerPrivateKey(string userNo, string password)
        {
            return userNo+ ":" + password;
        }
    }
    public class ReturnObj
    {
        public string message = "";
        public int code = 200;
        public string dataOfString = "";
        public JsonData dataOfJson = "";

        public ReturnObj(string data)
        {
            JsonData jd = JsonMapper.ToObject(data);

            if (jd.ContainsKey("code") == false)
                throw new Exception("err@返回的数据不符合预期的格式:" + data);

            this.message = jd["message"].ToString();
            this.code =int.Parse( jd["code"].ToString());
            this.dataOfString = jd["data"].ToString();
            this.dataOfJson = jd["data"];
        }
    }
}
